package com.xjrsoft.module.customerTwo.AppManage.industryinfo.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xjrsoft.core.tool.utils.StringUtil;
import com.xjrsoft.module.customerTwo.AppManage.industryinfo.entity.DwIndustryInfo;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.xjrsoft.core.tool.utils.CollectionUtil;
import java.util.ArrayList;
import com.xjrsoft.module.customerTwo.AppManage.industryinfo.dto.DwIndustryInfoListDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import java.util.List;
import com.xjrsoft.module.customerTwo.AppManage.industryinfo.mapper.DwIndustryInfoMapper;
import com.xjrsoft.module.customerTwo.AppManage.industryinfo.service.IDwIndustryInfoService;
import com.xjrsoft.core.mp.base.BaseService;
import com.xjrsoft.core.tool.utils.Func;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 *  服务实现类
 *
 * @author lisen
 * @since 2024-05-31
 */
@Service
@AllArgsConstructor
public class DwIndustryInfoServiceImpl extends BaseService<DwIndustryInfoMapper, DwIndustryInfo> implements IDwIndustryInfoService {


	@Override
	public IPage<DwIndustryInfo> getPageList(DwIndustryInfoListDto pageListDto) {
		Wrapper<DwIndustryInfo> wrapper = Wrappers.<DwIndustryInfo>query().lambda()
				.like(!StringUtil.isEmpty(pageListDto.getCl_year()), DwIndustryInfo::getClYear, pageListDto.getCl_year())
				.like(!StringUtil.isEmpty(pageListDto.getCl_month()), DwIndustryInfo::getClMonth, pageListDto.getCl_month())
				.eq(!StringUtil.isEmpty(pageListDto.getCl_gdp()), DwIndustryInfo::getClGdp, pageListDto.getCl_gdp())
				.eq(!StringUtil.isEmpty(pageListDto.getEnterprises()), DwIndustryInfo::getEnterprises, pageListDto.getEnterprises())
				.eq(!StringUtil.isEmpty(pageListDto.getG_enterprises()), DwIndustryInfo::getGEnterprises, pageListDto.getG_enterprises())
				.eq(!StringUtil.isEmpty(pageListDto.getExp_gdp()), DwIndustryInfo::getExpGdp, pageListDto.getExp_gdp())
				.eq(!StringUtil.isEmpty(pageListDto.getDom_gdp()), DwIndustryInfo::getDomGdp, pageListDto.getDom_gdp())
				.eq(!StringUtil.isEmpty(pageListDto.getCl_tex()), DwIndustryInfo::getClTex, pageListDto.getCl_tex())
				.eq(!StringUtil.isEmpty(pageListDto.getWl_factory()), DwIndustryInfo::getWlFactory, pageListDto.getWl_factory())
				.eq(!StringUtil.isEmpty(pageListDto.getZn_factory()), DwIndustryInfo::getZnFactory, pageListDto.getZn_factory())
				.eq(!StringUtil.isEmpty(pageListDto.getSzh_factory()), DwIndustryInfo::getSzhFactory, pageListDto.getSzh_factory())
				.eq(!StringUtil.isEmpty(pageListDto.getDt_factory()), DwIndustryInfo::getDtFactory, pageListDto.getDt_factory())
				.eq(!StringUtil.isEmpty(pageListDto.getGDP_rate()), DwIndustryInfo::getGdpRate, pageListDto.getGDP_rate())
				.eq(!StringUtil.isEmpty(pageListDto.getZz_enterprises()), DwIndustryInfo::getZzEnterprises, pageListDto.getZz_enterprises())
				.eq(!StringUtil.isEmpty(pageListDto.getCp_enterprises()), DwIndustryInfo::getCpEnterprises, pageListDto.getCp_enterprises())
				.eq(!StringUtil.isEmpty(pageListDto.getXj_enterprises()), DwIndustryInfo::getXjEnterprises, pageListDto.getXj_enterprises())
				.eq(!StringUtil.isEmpty(pageListDto.getHan_enterprises()), DwIndustryInfo::getHanEnterprises, pageListDto.getHan_enterprises())
				.eq(!StringUtil.isEmpty(pageListDto.getHan_enterprises_gdp()), DwIndustryInfo::getHanEnterprisesGdp, pageListDto.getHan_enterprises_gdp())
				.eq(!StringUtil.isEmpty(pageListDto.getCl_r_and_d()), DwIndustryInfo::getClRAndD, pageListDto.getCl_r_and_d())
				.eq(!StringUtil.isEmpty(pageListDto.getPatents()), DwIndustryInfo::getPatents, pageListDto.getPatents())
				.ge(!StringUtil.isEmpty(pageListDto.getCreate_date_Start()), DwIndustryInfo::getCreateDate, pageListDto.getCreate_date_Start())
				.le(!StringUtil.isEmpty(pageListDto.getCreate_date_End()), DwIndustryInfo::getCreateDate, pageListDto.getCreate_date_End())
				.ge(!StringUtil.isEmpty(pageListDto.getUpdate_date_Start()), DwIndustryInfo::getUpdateDate, pageListDto.getUpdate_date_Start())
				.le(!StringUtil.isEmpty(pageListDto.getUpdate_date_End()), DwIndustryInfo::getUpdateDate, pageListDto.getUpdate_date_End())
				.like(!StringUtil.isEmpty(pageListDto.getCreater()), DwIndustryInfo::getCreater, pageListDto.getCreater())
				.like(!StringUtil.isEmpty(pageListDto.getUpdater()), DwIndustryInfo::getUpdater, pageListDto.getUpdater());
		return this.page(ConventPage.getPage(pageListDto), wrapper);
	}

	@Override
	public Integer addDwIndustryInfo(DwIndustryInfo dwIndustryInfo) {
		boolean isSuccess = this.save(dwIndustryInfo);
		return isSuccess ? dwIndustryInfo.getId() : null;
	}

	@Override
	public boolean updateDwIndustryInfo(Integer id, DwIndustryInfo dwIndustryInfo) {
		dwIndustryInfo.setId(id);
		return this.updateById(dwIndustryInfo);
	}

	public boolean delete(String ids) {
		List<String> idList = Func.toStrList(ids);
		if (this.removeByIds(idList)) {
			return true;
		}
		return false;
	}

}